package com.home.databinding2

import android.os.Bundle
import android.util.Log
import android.widget.Button
import android.widget.Toast
import androidx.appcompat.app.AppCompatActivity
import androidx.databinding.DataBindingUtil
import com.home.databinding2.databinding.ActivityTwoWayBindingBinding

class TwoWayBindingActivity : AppCompatActivity() {
    var model = TwoWayBindingViewModel2()
    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContentView(R.layout.activity_two_way_binding)

        var binding: ActivityTwoWayBindingBinding =
            DataBindingUtil.setContentView(this, R.layout.activity_two_way_binding)
        binding.viewModel = model

        findViewById<Button>(R.id.button).setOnClickListener {
            Log.e("zzm debug", "${model.getUserName()} ; ${model.getPwd()}")
        }
    }
}